<?php

namespace api\qqinfo;

use app\Api;
use app\lib\ApiClient;
use app\lib\ApiClientException;


class App extends Api
{
    public function query()
    {
        $qq = input('get.qq', null, 'trim');

        //基本配置
        $api_key = 'BKrrQtTzQr0kMU85kNvjjd7EGX';
        try {
            $client = new ApiClient($api_key);
            $res = $client->get('https://api.nsmao.net/api/qq/query', [
                'key' => $api_key,
                'qq' => $qq
            ]);
            if ($res['code'] != 200) return msg(401, '获取失败');
            return json($res['data']);
        } catch (ApiClientException $e) {
            return msg(500, '获取失败');
        }
    }
}
